<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script src="js/mui.min.js"></script>
		<script src="js/vue.min.js"></script>
		<script src="js/url.js"></script>
		<script src="js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var code = GetQueryString("code");
			var state = GetQueryString("state");
			function GetQueryString(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				if (r != null) return unescape(r[2]);
				return null;
			}
			var str = state.split("@");
			var proId = str[0];
			var shopId = str[1];
			var userId = str[2];
			var flag = str[3];
			var app = new Vue({
				el: '#app',
				methods: {
					getData: function() {
						var _this = this;
						ajax({
							url: newUrl + "user/toShare",
							type: 'post',
							data: {
								code: code,
								userId:userId,
								shopId:shopId,
							},
							dataType: 'json',
							timeout: 10000,
							contentType: "application/json",
							success: function(data) {
								if(data.flag){
									var results = data.data;
									if(results.flag=="error"){
										alert(results.msg);
										return ;
									}else{
										sessionStorage.user = JSON.stringify(results.user);
										if(flag==0){//商品
											sessionStorage.productId = proId;
											window.location.replace("shareProduct.html")
										}
										if(flag==1){//文章
											sessionStorage.topId = proId;
											window.location.replace("shareTopic.html")
										}
										if(flag==2){//论坛
											sessionStorage.forumId = proId;
											window.location.replace("shareForum.html")
										}
										if(flag==3){//分享赚
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==4){//邀请好友
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==5){//抽奖分享
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==6){//分享卡卷
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==7){//分享小鸡
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==8){//趣味答题
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==9){//医生说
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==10){//抽奖有好礼
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==11){//分享健康自测
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==12){//好友助力
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==13){//视频
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==14){//个人排行榜
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==15){//门店排行榜
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==16){//分享签到
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==17){//拼团分享 group_status != 1
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
										if(flag==18){//拼团分享 group_status = 1
											// sessionStorage.forumId = proId;
											// window.location.replace("shareForum.html")
										}
									}
								}
							},
						})
					},
				}, 
				created: function() {
					this.getData();
		
				}
			})
		</script>
	</body>
</html>